import { Pagination, PageResult } from '@/types/global'
import { IUserInfo } from '@/types/user'
import { http } from '@/utils/http'

type MyParams = Pagination & { subType?: string } // 定义类型 类型是Pagination的属性 + subType属性

export const loginApi = (channelType: number, code: string) => {
  return http.post<IUserInfo>('/user/login', { channelType, code })
}

export const updateUserInfoApi = (userInfo: IUserInfo) => {
  return http.post<IUserInfo>('/user/update', userInfo)
}

// export const getUserAvatarApi = (userId: number) => {
//   return http.get<string>('/file/image/user/avatar', {
//     imageName: 'user_avatar_' + userId + '.png',
//   })
// }

export const myGroupMemberListApi = () => {
  return http.get<IUserInfo[]>('/user/myGroupMemberList')
}

export const userInfoApi = (userId: number) => {
  return http.get<IUserInfo>('/user/info', { userId })
}
